import * as THREE from "three";

export default class appGroup extends THREE.Group{
  constructor() {
    super();
    this.originSet = this.layers.set;
    this.layers.set = (index)=>{
      this.traverse((item)=>{
        if (item.uuid!==this.uuid){
          item.layers.set(index)
        }
      });
      this.layers.mask = 1 << index | 0;
    }
  }
  add(...object) {
    for (let i of object){
      i.traverse((item)=>{
        item.layers = this.layers
      });
    }
    return super.add(...object);
  }
}
